Learn R Programming

Compositional (version 1.4)

Fitting a Dirichlet distribution via Newton-Rapshon: Fitting a Dirichlet distribution via Newton-Rapshon

Description

Fitting a Dirichlet distribution via Newton-Rapshon.

Usage

diri.nr(x, type = 1, tol = 1e-07)

Arguments

x
A matrix containing the compositional data. Zeros are not allowed.
type
Type can either be 1, so that the Newton-Rapshon is used for the maximisation of the log-likelihood, as Minka (2012) suggested or it can be 1. In the latter case the Newton-Raphson algorithm is implemented involving matrix inversions.
tol
The tolerance level idicating no further increase in the log-likelihood.

Value

A list including:
iter
The number of iterations required.
loglik
The value of the log-likelihood.
param
The estimated parameters.
runtime
The run time of the procedure.

Details

Maximum likelihood estimation of the parameters of a Dirichlet distribution is performed via Newton-Raphson. Initial values suggested by Minka (2003) are used. The estimatation is super faster than "diri.est" and the difference becomes really apparent when the sample size and or the dimensions increase. In fact this will work with millions of observations. So in general, I trust this one more than "diri.est".

The only problem I have seen with this method is that if the data are concentrated around a point, say the center of the simplex, it will be hard for this and the previous methods to give estimates of the parameters. In this extremely difficult scenario I would suggest the use of the previous function with the precision parametrisation "diri.est(x, type = "prec")". It will be extremely fast and accurate.

References

Thomas P. Minka (2003). Estimating a Dirichlet distribution. http://research.microsoft.com/en-us/um/people/minka/papers/dirichlet/minka-dirichlet.pdf

See Also

diri.est, diri.contour rdiri

Examples

Run this code
x <- rdiri( 100, c(5, 7, 1, 3, 10, 2, 4) )
diri.nr(x)
diri.nr(x, type = 2)
diri.est(x)

Run the code above in your browser using DataLab